<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>12月份“明星医生”招募令！</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no, email=no" />
<link href="${base}/res/plugins/activity/common/css/main.css" rel="stylesheet"/>
<link rel="stylesheet" href="${base}/res/plugins/activity/common/css/animate.min.css"/>
<link rel="stylesheet" href="${base}/res/plugins/activity/common/css/common.css"/>
<script type="text/javascript" src="${base}/res/plugins/activity/common/js/jquery-1.9.1.min.js"></script>

<!--弹窗样式-->
<script type="text/javascript" src="${base}/res/plugins/activity/common/js/jquery.min.js"></script>
<script type="text/javascript" src="${base}/res/plugins/activity/common/js/jquery.form.js"></script>
<script type="text/javascript" src="${base}/res/plugins/activity/common/js/tooltips.js"></script>
<!--微信分享-->
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
<style>
    #HBox{
        height: 345px;
    }
</style>
</head>
<body >

    <div class="water content">
        <img class="lazy" data-original="${base}/res/plugins/activity/mxys/images/1.png" />

    </div>
    <div id="HBox">
        <form action="" method="post" novalidate>
            <a id="HCloseBtn" title="关闭"><span>×</span></a>
            <ul class="list">
                <li>
                    <div class="fl">
                        <input type="text" name="nickname" id="" value="" placeholder="请输入姓名" required class="ipt nickname" />                  </div>
                </li>
                <li>
                    <div class="fl">
                        <input type="text" name="phone" value="" placeholder="请输入手机号" required class="ipt phone" />                       </div>
                </li>
                <li><input type="text" name="department" placeholder="请输入科室" class="ipt remark"></li>
                <li><input type="text" name="company" placeholder="请输入医院名称" class="ipt remark"></li>
                <li><input value="确认提交" class="submitBtn" readonly/></li>
            </ul>
        </form>
    </div><!-- HBox end -->
    <div class="bounceIn dialog footer">立即报名</div>
    <script src="${base}/res/plugins/activity/common/js/jquery.hDialog.min.js"></script>
    <script src="${base}/res/plugins/activity/common/js/jquery.lazyload.js"></script>
    <script>       
        $(function(){
            $("img.lazy").lazyload({
                effect: "fadeIn"
            });
            var $el = $('.dialog');
	        $el.hDialog(); //默认调用
            $('.dialog').hDialog(); //打开效果调用
            //返回顶部
            $.goTop();
            //提交并验证表单
            $('.submitBtn').click(function() {
                var PhoneReg = /^0?(13[0-9]|15[0-9]|17[0-9]|18[0-9]|14[57])[0-9]{8}$/ ; //手机正则

                var NicknameReg=/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/;
                var nickname = $("input[name='nickname']").val();
                var phone = $("input[name='phone']").val();
                var remark=$("input[name='remark']").val();
                var department=$("input[name='department']").val();
                var company=$("input[name='company']").val();


                if(!nickname){
                    show_err_msg('姓名还没填呢...');
                    //$.tooltip('姓名还没填呢...');
                    return;
                }else if(!NicknameReg.test(nickname)){
                    show_err_msg('姓名存在非法字符...');
                    //$.tooltip('姓名存在非法字符...');
                    return;
                }else if(!phone){
                    show_err_msg('手机还没填呢...');
                    //$.tooltip('手机还没填呢...');
                    return;
                }else if(!PhoneReg.test(phone)){
                    show_err_msg('手机格式错咯...');
                    //$.tooltip('手机格式错咯...');
                    return;
                }else if(!department){
                    show_err_msg('科室还没填呢...');
                    return;
                }else if(!company){
                    show_err_msg('医院名称没填呢...');
                    return;
                }
//                dosubmit=false;
                $.ajax({
                    url: "${weburl}/shop/activity/mxys",
                    type: 'GET',
                    data:{
                        "nickname":nickname,
                        "phone":phone,
                        "department":department,
                        "company":company,
                    },
                    success: function(data){
                        if(data.code == 1){
                            //注册错误
                            show_err_msg(data.desc);
                        }else if (data.code == 0){
                            show_err_msg('恭喜您报名成功');
                            setTimeout(function(){
                                $("#HBox").hide();
                                $("#HOverlay").hide();
                            },2500);

                        }
                    }});
            });
        });

        wx.config({
            debug: false,
            appId : '${appId}',
            timestamp : '${timestamp}',
            nonceStr : '${nonceStr }',
            signature : '${signature}',
            jsApiList : [ 'onMenuShareTimeline', 'onMenuShareAppMessage',
                'onMenuShareQQ', ]
        });
        wx.ready(function() {
            /* 发送给朋友 */
            wx.onMenuShareAppMessage({
                title: '12月份“明星医生”招募令!',
                desc: '我已报名12月份“明星医生”招募令，你也赶快报名吧！',
                link: '${weburl}/shop/activity/mxysform',
                imgUrl: '${weburl}/activity/mxys/images/mxys.jpg',
                fail: function (res) {
                    alert(JSON.stringify(res));
                }
            });
            /* 分享到朋友圈 */
            wx.onMenuShareTimeline({
                title: '12月份“明星医生”招募令!',
                link: '${weburl}/shop/activity/mxysform',
                imgUrl: '${weburl}/activity/mxys/images/mxys.jpg',
                fail: function (res) {
                    alert(JSON.stringify(res));
                }
            });
            /* 分享到QQ */
            wx.onMenuShareQQ({
                title: '12月份“明星医生”招募令!',
                desc: '我已报名12月份“明星医生”招募令，你也赶快报名吧！',
                link: '${weburl}/shop/activity/mxysform',
                imgUrl: '${weburl}/activity/mxys/images/mxys.jpg',
                complete: function (res) {
                    alert(JSON.stringify(res));
                },
                fail: function (res) {
                    alert(JSON.stringify(res));
                }
            });
            /*分享到微博*/
            wx.onMenuShareWeibo({
                title: '12月份“明星医生”招募令!',
                desc: '我已报名12月份“明星医生”招募令，你也赶快报名吧！',
                link: '${weburl}/shop/activity/mxysform',
                imgUrl: '${weburl}/activity/mxys/images/mxys.jpg',
                complete: function (res) {
                    alert(JSON.stringify(res));
                },
                fail: function (res) {
                    alert(JSON.stringify(res));
                }
            });
        });

    </script>
</body>
</html>
